package com.sgb.goods.view.adapter;

import android.content.Context;

import androidx.databinding.ViewDataBinding;

import com.chad.library.adapter.base.BaseViewHolder;
import com.sgb.goods.BR;
import com.sgb.goods.R;
import com.sgb.goods.entity.OrderListEntity;
import com.sgb.goods.utils.base.adapter.BaseCommonAdapter;

/**
 * 订单列表适配器
 * @author cyj
 */
public class OrderListAdapter extends BaseCommonAdapter<OrderListEntity> {

    /** 订单类型。1：采购订单；2：销售订单。 */
    public String orderDescribe = "";

    public OrderListAdapter() {
        super(R.layout.goods_item_order_list);
    }

    /**
     * 设置订单类型
     * @param orderType
     */
    public void setOrderType(String orderType) {
        this.orderDescribe = orderType;
    }

    @Override
    protected void convert(BaseViewHolder baseHolder, ViewDataBinding dataBinding, OrderListEntity entity) {
        dataBinding.setVariable(BR.entity, entity.init(this.orderDescribe));
        dataBinding.setVariable(BR.adapter, this);

        baseHolder.addOnClickListener(R.id.tv_pay_info)
                .addOnClickListener(R.id.tv_deliver_info)
                .addOnClickListener(R.id.tv_order_record)
                .addOnClickListener(R.id.tv_title)
                .addOnClickListener(R.id.tv_contract_info)
                .addOnClickListener(R.id.ll_goods_desc);
    }
}
